Skip to content

feat: support content chunk updates with dot notation and fix richTex… - #18

Merged
sweden-snow merged 3 commits into
mainfrom
feat/content-chunk-update
Apr 10, 2026
Merged

feat: support content chunk updates with dot notation and fix richTex…#18
sweden-snow merged 3 commits into
mainfrom
feat/content-chunk-update

Conversation

@sweden-snow

Copy link
Copy Markdown
Contributor

…t mutations

  • Add nested component updates via dot notation (e.g. image-and-title.title),
  • Round-trip sibling preservation with contentToInput,
  • Fix richText mutations to use json format instead of invalid plainText field.

…t mutations

- Add nested component updates via dot notation (e.g. image-and-title.title),
- Round-trip sibling preservation with contentToInput,
- Fix richText mutations to use json format instead of invalid plainText field.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the content mutation tooling to support updating nested components inside contentChunk components using dot notation, improves mutation round-tripping to preserve sibling fields, and fixes rich text mutations to use a JSON payload instead of an invalid plainText input.

Changes:

  • Add dot-notation support for updating contentChunk child components (e.g. hero.title) in update_component.
  • Introduce contentToInput to rebuild mutation inputs from existing content to better preserve siblings during updates.
  • Update rich text mutation input to use richText.json instead of richText.plainText, and expand docs/tests accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/tools/content.ts Implements dot-notation parsing, chunk-child updates, sibling round-tripping, and richText JSON mutations.
tests/content.test.ts Updates dry-run stubs and adds coverage for dot-notation updates and invalid chunk child errors.
README.md Documents write tools, dry-run mode, and content tools; updates the tool count.
Comments suppressed due to low confidence (1)

src/tools/content.ts:633

  • The dry-run preview string still says Mutation: item.updateComponent(...), but the actual mutation executed below is updateComponent(...) (root field) via nextPimApi. Update the preview text to match the real mutation shape so users aren’t misled when reviewing dry-run output/audit logs.
            `Current value: ${currentValue}`,
            `New value: ${JSON.stringify(value)}`,
            '',
            `Mutation: item.updateComponent(itemId: "${itemId}", language: "${language}", component: ${JSON.stringify(componentInput)})`,
            '',

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/content.ts
Comment thread src/tools/content.ts Outdated
Comment thread src/tools/content.ts Outdated
- Unsupp sibling safety

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/tools/content.ts:658

  • Dry-run preview still prints item.updateComponent(...), but the actual mutation executed below is updateComponent(...) (top-level). This makes the preview misleading; align the dry-run “Mutation:” line with the real mutation shape (or update the mutation if the nested form is the correct API).
            `Current value: ${currentValue}`,
            `New value: ${JSON.stringify(value)}`,
            '',
            `Mutation: item.updateComponent(itemId: "${itemId}", language: "${language}", component: ${JSON.stringify(componentInput)})`,
            '',

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/content.ts
Comment thread src/tools/content.ts Outdated
Comment thread src/tools/content.ts Outdated
Comment thread src/tools/content.ts Outdated
- get_shape: fix GraphQL inline fragments (repeatable vs repeating, proper type spreads)
- get_item: add ContentChunkContent fragment so chunk rows are returned
- update_component: add rowIndex param to target specific rows in repeating chunks;
  fix critical bug where only the target row was sent back in the mutation,
  wiping all other rows (shadowed const allRows inside try block)
@sweden-snow
sweden-snow merged commit a68f6b8 into main Apr 10, 2026
1 check passed
istonejoeljonsson added a commit that referenced this pull request Apr 13, 2026
* 'main' of github.com:HayoDev/crystallize-mcp:
  chore(main): release crystallize-mcp 0.2.0 (#24)
  feat!: setup-wizard :nail-care: (#23)
  chore(main): release crystallize-mcp 0.1.10 (#22)
  fix: improve setup wizard and docs (#21)
  chore(main): release crystallize-mcp 0.1.9 (#20)
  feat: support content chunk updates with dot notation and fix richTex… (#18)
istonejoeljonsson added a commit that referenced this pull request Apr 13, 2026
* main:
  chore(main): release crystallize-mcp 0.2.0 (#24)
  feat!: setup-wizard :nail-care: (#23)
  chore(main): release crystallize-mcp 0.1.10 (#22)
  fix: improve setup wizard and docs (#21)
  chore(main): release crystallize-mcp 0.1.9 (#20)
  feat: support content chunk updates with dot notation and fix richTex… (#18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants